import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:get/get.dart';
import 'package:smart_devices/bruno/src/components/tabbar/normal/brn_tab_bar.dart';
import 'package:smart_devices/icons/src/antd_icons.dart';
import 'package:smart_devices/model/spare_part.dart';
import 'package:smart_devices/model/upkeep_task.dart';
import 'package:smart_devices/routes/index.dart';
import 'package:smart_devices/ui/my_custom_paint_line.dart';
import 'package:smart_devices/utils/colors.dart';
import 'package:smart_devices/utils/styles.dart';
import 'package:smart_devices/utils/tools.dart';
import 'package:smart_devices/views/device/repair/info/info_view.dart';
import 'dart:math' as math;

import 'info_logic.dart';

class UpkeepInfoView extends StatefulWidget {
  const UpkeepInfoView({Key? key}) : super(key: key);

  @override
  State<UpkeepInfoView> createState() {
    return _UpkeepInfoView();
  }
}

class _UpkeepInfoView extends State<UpkeepInfoView>
    with SingleTickerProviderStateMixin {
  late ScrollController scrollController;

  late TabController tabController;

  List<BadgeTab> tabs = [];

  SparePartModel details = SparePartModel(
      imgUrl: '',
      name: '',
      code: '',
      model: '',
      count: 0,
      change: 0,
      inventory: 0);

  UpkeepTaskModel task = UpkeepTaskModel(
    title: '',
    taskNo: '',
    name: '',
    code: '',
    location: '',
    addTime: '',
  );

  List<GlobalKey> tabKeys = [];

  bool isTabClicked = false;

  double expandedHeight = 230.0;

  /// 触发距离
  double offset = 50.0;

  @override
  void initState() {
    super.initState();
    tabs.add(BadgeTab(text: '任务信息'));
    tabs.add(BadgeTab(text: '保养明细'));
    tabs.add(BadgeTab(text: '工作量'));
    tabs.add(BadgeTab(text: '更换备件'));
    tabs.add(BadgeTab(text: '验证信息'));
    scrollController = ScrollController();
    scrollController.addListener(onScroll);
    tabController = TabController(length: tabs.length, vsync: this);
    for (var i = 0; i < tabs.length; i++) {
      tabKeys.add(GlobalKey(debugLabel: 'tab_$i'));
    }
    if (Get.arguments != null) {
      details = Get.arguments['details'] as SparePartModel;
      task = Get.arguments['task'] as UpkeepTaskModel;
    }
  }

  @override
  void dispose() {
    super.dispose();
    scrollController.removeListener(onScroll);
    scrollController.dispose();
    Get.delete<UpkeepInfoLogic>();
  }

  void onTabChange(i) {
    final keyRenderObject =
        tabKeys[i].currentContext?.findAncestorRenderObjectOfType();
    if (keyRenderObject != null) {
      // 点击的时候不让滚动影响tab
      isTabClicked = true;
      scrollController.position
          .ensureVisible(keyRenderObject,
              duration: const Duration(milliseconds: 300), curve: Curves.easeIn)
          .then((value) {
        isTabClicked = false;
      });
    }
  }

  void onScroll() {
    Get.log('offset = ${scrollController.offset}');
    if (isTabClicked) return;
    int i = 0;
    for (; i < tabKeys.length; i++) {
      final keyRenderObject =
          tabKeys[i].currentContext?.findAncestorRenderObjectOfType();
      if (keyRenderObject != null) {
        final offsetY = (keyRenderObject.parentData as SliverPhysicalParentData)
            .paintOffset
            .dy;
        Get.log('offsetY = $offsetY \ti = $i');
        if (offsetY > kToolbarHeight + offset) {
          break;
        }
      }
    }
    final newIndex = i == 0 ? 0 : i - 1;
    if (newIndex != tabController.index) {
      tabController.animateTo(newIndex);
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: IconButton(
          icon: const Icon(
            Icons.arrow_back_ios,
            color: Colors.white,
            size: 15,
          ),
          onPressed: Get.back,
        ),
        automaticallyImplyLeading: false,
        title: Text(
          '保养任务详情',
          style: StylesUtils.customTextStyle(
              fontSize: 18, fontWeight: FontWeight.w700),
        ),
        centerTitle: true,
      ),
      body: CustomScrollView(
        controller: scrollController,
        slivers: [
          SliverPersistentHeader(
              delegate: SliverHeaderDelegate(
                  maxHeight: expandedHeight,
                  minHeight: expandedHeight,
                  child: Container(
                    decoration: const BoxDecoration(color: Colors.white),
                    margin: const EdgeInsets.only(bottom: 10),
                    child: Column(
                      children: [
                        Row(
                          children: [
                            Container(
                              width: 140,
                              height: 140,
                              alignment: Alignment.center,
                              child: Container(
                                width: 120,
                                height: 120,
                                decoration: BoxDecoration(
                                  borderRadius: BorderRadius.circular(5),
                                  color: ColorsUtils.parseColorFromHexString(
                                      ColorsUtils.color669e),
                                ),
                                child: ToolsUtils.assetImageSvg('u4201.svg',
                                    width: 46, height: 58),
                              ),
                            ),
                            Expanded(
                                child: Container(
                                    padding: const EdgeInsets.symmetric(
                                        vertical: 10),
                                    child: Stack(
                                      children: [
                                        Column(
                                          children: [
                                            Container(
                                              height: 40,
                                              alignment: Alignment.centerLeft,
                                              child: Text(
                                                details.name,
                                                style:
                                                    StylesUtils.customTextStyle(
                                                        fontSize: 18,
                                                        fontWeight:
                                                            FontWeight.w700,
                                                        color: ColorsUtils
                                                            .color1c24),
                                              ),
                                            ),
                                            Container(
                                              height: 30,
                                              alignment: Alignment.centerLeft,
                                              child: Wrap(
                                                spacing: 5,
                                                children: [
                                                  Text(
                                                    '设备编号：',
                                                    style: StylesUtils
                                                        .customTextStyle(
                                                            color: ColorsUtils
                                                                .color3333),
                                                  ),
                                                  Text(
                                                    details.code,
                                                    style: StylesUtils
                                                        .customTextStyle(
                                                            color: ColorsUtils
                                                                .colorAaaa),
                                                  )
                                                ],
                                              ),
                                            ),
                                            Container(
                                              height: 30,
                                              alignment: Alignment.centerLeft,
                                              child: Wrap(
                                                spacing: 5,
                                                children: [
                                                  Text(
                                                    '规格型号：',
                                                    style: StylesUtils
                                                        .customTextStyle(
                                                            color: ColorsUtils
                                                                .color3333),
                                                  ),
                                                  Text(
                                                    details.model,
                                                    style: StylesUtils
                                                        .customTextStyle(
                                                            color: ColorsUtils
                                                                .colorAaaa),
                                                  )
                                                ],
                                              ),
                                            ),
                                            Container(
                                              height: 30,
                                              alignment: Alignment.centerLeft,
                                              child: Wrap(
                                                spacing: 5,
                                                children: [
                                                  Text(
                                                    '设备类型：',
                                                    style: StylesUtils
                                                        .customTextStyle(
                                                            color: ColorsUtils
                                                                .color3333),
                                                  ),
                                                  Text(
                                                    details.code,
                                                    style: StylesUtils
                                                        .customTextStyle(
                                                            color: ColorsUtils
                                                                .colorAaaa),
                                                  )
                                                ],
                                              ),
                                            )
                                          ],
                                        ),
                                        Positioned(
                                            top: 10,
                                            right: 10,
                                            width: 70,
                                            height: 70,
                                            child: Container(
                                              alignment: Alignment.center,
                                              decoration: BoxDecoration(
                                                  image: DecorationImage(
                                                      image: ToolsUtils
                                                          .assetImageIcon(
                                                              'u1570.png'))),
                                              child: Transform.rotate(
                                                angle: -math.pi / 5.0,
                                                child: Text(
                                                  '已完成',
                                                  style: StylesUtils
                                                      .customTextStyle(
                                                          fontWeight:
                                                              FontWeight.w700,
                                                          color: ColorsUtils
                                                              .color00b2,
                                                          fontSize: 12),
                                                ),
                                              ),
                                            ))
                                      ],
                                    )))
                          ],
                        ),
                        Container(
                          height: 30,
                          padding: const EdgeInsets.only(left: 20),
                          alignment: Alignment.centerLeft,
                          child: Wrap(
                            spacing: 5,
                            children: [
                              Text(
                                '使用部门：',
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.color3333),
                              ),
                              Text(
                                '生产部门',
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.colorAaaa),
                              )
                            ],
                          ),
                        ),
                        Container(
                          height: 30,
                          padding: const EdgeInsets.only(left: 20),
                          alignment: Alignment.centerLeft,
                          child: Wrap(
                            spacing: 5,
                            children: [
                              Text(
                                '存放位置：',
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.color3333),
                              ),
                              Text(
                                '新产品N205生产车间二层一车间',
                                maxLines: 1,
                                overflow: TextOverflow.ellipsis,
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.colorAaaa),
                              )
                            ],
                          ),
                        ),
                      ],
                    ),
                  ))),
          SliverPersistentHeader(
            pinned: true,
            delegate: SliverHeaderDelegate(
                child: Container(
                    decoration: BoxDecoration(
                        color: Colors.white,
                        border: Border(
                            bottom: BorderSide(
                                color: ColorsUtils.rgba(235, 235, 235, 1)))),
                    child: BrnTabBar(
                      tabs: tabs,
                      controller: tabController,
                      isScroll: true,
                      tabWidth: 80,
                      tagHeight: 50,
                      tagSpacing: 10,
                      labelStyle: StylesUtils.customTextStyle(
                          color: ColorsUtils.color0052),
                      labelColor: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.color0052),
                      unselectedLabelStyle: StylesUtils.customTextStyle(
                          color: ColorsUtils.color3333),
                      unselectedLabelColor: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.color3333),
                      indicatorColor: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.color0052),
                      indicatorWeight: 3,
                      indicatorWidth: 30,
                      onTap: (BrnTabBarState state, int index) {
                        onTabChange(index);
                      },
                    )),
                minHeight: offset,
                maxHeight: offset),
          ),
          SliverToBoxAdapter(
            child: Container(
              key: tabKeys[0],
              height: 40,
              color: Colors.white,
              margin: const EdgeInsets.only(top: 10),
              child: CustomPaint(
                  painter: MyCustomPaintLine(),
                  child: Container(
                    margin: const EdgeInsets.only(left: 30),
                    alignment: Alignment.centerLeft,
                    child: Text(
                      '${tabs[0].text}',
                      style: StylesUtils.customTextStyle(
                          color: ColorsUtils.color6666),
                    ),
                  )),
            ),
          ),
          SliverList.list(children: [
            Container(
              color: Colors.white,
              child: ListBody(
                children: [
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '是否更换',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '是',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '领用单号',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'LY2022645',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '领用主题',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '备件领用申请202224',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '申请时间',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '2023-10-17',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '领用原因',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '失灵',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '仓库名称',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '仓库一',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '申请备件',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '3种备件，总数量6',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        ),
                        InkWell(
                          onTap: () {
                            Get.toNamed(Routes.deviceSpareParticulars);
                          },
                          child: Container(
                            width: 50,
                            alignment: Alignment.center,
                            child: Icon(
                              AntdIcons.right,
                              color: ColorsUtils.parseColorFromHexString(
                                  ColorsUtils.color9999),
                              size: 15,
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                ],
              ),
            )
          ]),
          SliverToBoxAdapter(
            child: Container(
              key: tabKeys[1],
              height: 40,
              color: Colors.white,
              margin: const EdgeInsets.only(top: 10),
              child: CustomPaint(
                  painter: MyCustomPaintLine(),
                  child: Container(
                    margin: const EdgeInsets.only(left: 30),
                    alignment: Alignment.centerLeft,
                    child: Text(
                      '${tabs[1].text}',
                      style: StylesUtils.customTextStyle(
                          color: ColorsUtils.color6666),
                    ),
                  )),
            ),
          ),
          SliverList.list(children: [
            Container(
              color: Colors.white,
              child: ListBody(
                children: [
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '是否更换',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '是',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '领用单号',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'LY2022645',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '领用主题',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '备件领用申请202224',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '申请时间',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '2023-10-17',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '领用原因',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '失灵',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '仓库名称',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '仓库一',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '申请备件',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '3种备件，总数量6',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        ),
                        InkWell(
                          onTap: () {
                            Get.toNamed(Routes.deviceSpareParticulars);
                          },
                          child: Container(
                            width: 50,
                            alignment: Alignment.center,
                            child: Icon(
                              AntdIcons.right,
                              color: ColorsUtils.parseColorFromHexString(
                                  ColorsUtils.color9999),
                              size: 15,
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                ],
              ),
            )
          ]),
          SliverToBoxAdapter(
            child: Container(
              key: tabKeys[2],
              height: 40,
              color: Colors.white,
              margin: const EdgeInsets.only(top: 10),
              child: CustomPaint(
                  painter: MyCustomPaintLine(),
                  child: Container(
                    margin: const EdgeInsets.only(left: 30),
                    alignment: Alignment.centerLeft,
                    child: Text(
                      '${tabs[2].text}',
                      style: StylesUtils.customTextStyle(
                          color: ColorsUtils.color6666),
                    ),
                  )),
            ),
          ),
          SliverList.list(children: [
            Container(
              color: Colors.white,
              child: ListBody(
                children: [
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '是否更换',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '是',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '领用单号',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'LY2022645',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '领用主题',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '备件领用申请202224',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '申请时间',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '2023-10-17',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '领用原因',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '失灵',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '仓库名称',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '仓库一',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '申请备件',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '3种备件，总数量6',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        ),
                        InkWell(
                          onTap: () {
                            Get.toNamed(Routes.deviceSpareParticulars);
                          },
                          child: Container(
                            width: 50,
                            alignment: Alignment.center,
                            child: Icon(
                              AntdIcons.right,
                              color: ColorsUtils.parseColorFromHexString(
                                  ColorsUtils.color9999),
                              size: 15,
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                ],
              ),
            )
          ]),
          SliverToBoxAdapter(
            child: Container(
              key: tabKeys[3],
              height: 40,
              color: Colors.white,
              margin: const EdgeInsets.only(top: 10),
              child: CustomPaint(
                  painter: MyCustomPaintLine(),
                  child: Container(
                    margin: const EdgeInsets.only(left: 30),
                    alignment: Alignment.centerLeft,
                    child: Text(
                      '${tabs[3].text}',
                      style: StylesUtils.customTextStyle(
                          color: ColorsUtils.color6666),
                    ),
                  )),
            ),
          ),
          SliverList.list(children: [
            Container(
              color: Colors.white,
              child: ListBody(
                children: [
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '是否更换',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '是',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '领用单号',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'LY2022645',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '领用主题',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '备件领用申请202224',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '申请时间',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '2023-10-17',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '领用原因',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '失灵',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '仓库名称',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '仓库一',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '申请备件',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '3种备件，总数量6',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        ),
                        InkWell(
                          onTap: () {
                            Get.toNamed(Routes.deviceSpareParticulars);
                          },
                          child: Container(
                            width: 50,
                            alignment: Alignment.center,
                            child: Icon(
                              AntdIcons.right,
                              color: ColorsUtils.parseColorFromHexString(
                                  ColorsUtils.color9999),
                              size: 15,
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                ],
              ),
            )
          ]),
          SliverToBoxAdapter(
            child: Container(
              key: tabKeys[4],
              height: 40,
              color: Colors.white,
              margin: const EdgeInsets.only(top: 10),
              child: CustomPaint(
                  painter: MyCustomPaintLine(),
                  child: Container(
                    margin: const EdgeInsets.only(left: 30),
                    alignment: Alignment.centerLeft,
                    child: Text(
                      '${tabs[4].text}',
                      style: StylesUtils.customTextStyle(
                          color: ColorsUtils.color6666),
                    ),
                  )),
            ),
          ),
          SliverList.list(children: [
            Container(
              color: Colors.white,
              child: ListBody(
                children: [
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '是否更换',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '是',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '领用单号',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'LY2022645',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '领用主题',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '备件领用申请202224',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '申请时间',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '2023-10-17',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '领用原因',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '失灵',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '仓库名称',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '仓库一',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 50,
                    child: Row(
                      children: [
                        Container(
                          width: 100,
                          alignment: Alignment.centerLeft,
                          padding: const EdgeInsets.only(left: 30),
                          child: Text(
                            '申请备件',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color3333),
                          ),
                        ),
                        Expanded(
                          child: Container(
                            padding: const EdgeInsets.only(left: 10),
                            alignment: Alignment.centerLeft,
                            child: Text(
                              '3种备件，总数量6',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color9999),
                            ),
                          ),
                        ),
                        InkWell(
                          onTap: () {
                            Get.toNamed(Routes.deviceSpareParticulars);
                          },
                          child: Container(
                            width: 50,
                            alignment: Alignment.center,
                            child: Icon(
                              AntdIcons.right,
                              color: ColorsUtils.parseColorFromHexString(
                                  ColorsUtils.color9999),
                              size: 15,
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                ],
              ),
            )
          ]),
        ],
      ),
    );
  }
}
